package com.cn.springcloudattachment.service.impl;

import com.cn.Api.inter.TestClientApi;
import com.cn.Api.inter.TestService;
import com.cn.springcloudattachment.mapper.URoleMapper;
import com.cn.springcloudattachment.model.URole;
import com.cn.springcloudattachment.service.inter.DemoService;
import com.codingapi.tx.annotation.TxTransaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("DemoService")
public class DemoServiceImpl implements DemoService {

    @Autowired
    URoleMapper uRoleMapper;
    @Autowired
    TestClientApi testService;

    @Override
    @TxTransaction(isStart = true)
    @Transactional(rollbackFor = Exception.class)
    public int add(String name) {
        System.out.println("调用attach");
        uRoleMapper.add(name);
        testService.add("client");
        return 1;
    }
}
